home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_gen_setthingmesh.cog < prev    next >
Text File  |  1999-11-15  |  2KB  |  93 lines

  1. # Jones 3D Cog Script
  2. #
  3. # gen_SetThingMesh.cog
  4. #
  5. # This COG is meant to be used as template only.  Requires a tagged
  6. # keyframe file to trigger the callback message.
  7. #
  8. # [RandyT]
  9. #
  10. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  11. #
  12. # ===================================================================
  13.  
  14. symbols
  15.  
  16. message        startup
  17. message        activated
  18. message     callback
  19. message     timer
  20.  
  21. keyframe    use=in_useitem.key                local
  22.  
  23. model        sourceModel=hand_in_oilcan.3do    local
  24.     
  25. thing          player                            local
  26. thing          indy_actor                        nolink
  27. thing          trigger
  28.                     
  29. int         handMesh                        local
  30. int         swapRef                            local
  31.  
  32. int            itemNum=81                        local
  33.  
  34. int            bSet=0                            local
  35.         
  36. end
  37.  
  38. # ===================================================================
  39.  
  40. code
  41.  
  42. startup:
  43.  
  44.     player = GetLocalPlayerThing();
  45.     handMesh = GetMeshByName(player, "inrhand");
  46.     return;
  47.  
  48. # -------------------------------------------------------------------
  49.  
  50. activated:
  51.  
  52.     if (GetCurItem(player) == itemNum)
  53.     {
  54.         # Disable player controls and stuff
  55.         if (MakeMeStop() == -1)
  56.             return;
  57.         DeselectWeaponWait(player);
  58.  
  59.         # Capture thing so we get the callback message
  60.         CaptureThing(player);
  61.  
  62.         # Play the tagged keyframe
  63.         PlayKey(player, use, 5, 0x12, 0);
  64.     }
  65.  
  66.     return;
  67.  
  68. # -------------------------------------------------------------------
  69.  
  70. callback:
  71.  
  72.     # Setting
  73.     if (!bSet)
  74.     {
  75.         swapRef = SetThingMesh(player, handMesh, sourceModel, 0);
  76.     }
  77.     # Restoring
  78.     else
  79.     {
  80.         RestoreThingMesh(player, swapRef);
  81.  
  82.         ReleaseThing(player);
  83.         ClearActorFlags(player, 0x200000);
  84.     }
  85.         
  86.     bSet = 1 - bSet;
  87.     return;
  88.  
  89. end
  90.  
  91.  
  92.  
  93.